package world.criver.h50909.route;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import world.criver.h50909.properties.proConfig;

import java.io.File;

@Controller
public class rouHome {
    @Autowired
    private proConfig config;
    @GetMapping(value={"","/","/{path:[0-9a-zA-Z]*}"})
    public String home(@PathVariable(required = false) String path){
//        System.out.println("1:"+config.getPath());
//        System.out.println("2:"+path);
//        System.out.println(new File(config.getLocal_path()+"material/logo.png").length());
        if(config.getPath()==null && path==null)return "html/home";
        if(path.equals(config.getPath()))return "html/home";
        return "html/error";
    }
}